#define CRTDBG_MAP_ALLOC
#define _CRTDBG_MAP_ALLOC 
#include <stdlib.h>
#include <crtdbg.h>

#include "../test_frame/test_frame.h"

class CTestModel : public CTestFrame
{
public:
	BOOL CreateScene()
	{
		CEntityModel* entityModel = new CEntityModel(_scene);
		entityModel->LoadFromFile("model/marine.model.xml");
		entityModel->EnableShadowReceive(FALSE);
		entityModel->EnableShadowCast(FALSE);

		sceneNode = new CSceneNode(_scene);
		_scene->AddChild(sceneNode);
		sceneNode->AttachEntity(entityModel);
		//sceneNode->SetRelativeScale(D3DXVECTOR3(0.3f, 0.3f, 0.3f));
		sceneNode->Release();

		return TRUE;
	}

	void Active()
	{
		UINT iTime = timeGetTime() % 5000;
    FLOAT fAngle = iTime * ( 2.0f * D3DX_PI ) / 5000.0f;
 		//sceneNode->SetRelativeRotationYawPitchRoll(fAngle,fAngle,fAngle);
		CTestFrame::Active();
	}

private:
	CSceneNode* sceneNode;
};

void main()
{
	_CrtSetDbgFlag (_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);

	CTestModel app;
	if (app.CreateFrame("../../../../media/3d/", 640, 480, RDT_DIRECT3D9))
		app.MainLoop();
	app.DestroyFrame();
}